<template>
<!-- 侧边栏菜单区域 -->
<el-menu unique-opened background-color="#a29bfe" :collapse='iscollapse'
:collapse-transition='false'  router  default-active="activePath"
 active-text-color="#409eee" text-color="#fff">
   <!-- 一级菜单 -->
   <el-submenu :index="item.path + ''"  v-for="item in menus" :key="item.id">
     <!-- 一级菜单模板区域 -->
     <template slot="title">
       <!-- 一级菜单图标 -->
       <i :class="iconList[item.id]"></i>
       <!-- 一级菜单文本 -->
       <span>{{item.authName}}</span>
     </template>
     <el-menu-item :index="items.path + ''"
       v-for="items in item.children"
       :key="items.id"
       @click="activePathclick(items.path + '')">
      <template slot="title">
         <i class="el-icon-menu"></i>
        <!-- 一级菜单文本 -->
        <span>{{items.authName}}</span>
      </template>
       <!-- <el-menu-item index="1-4-1">选项1</el-menu-item> -->
     </el-menu-item>
   </el-submenu>
 </el-menu>
</template>

<script>

export default {
  name: 'homeaside',
  components: {
  },
  data () {
    return {
      iconList: {
        125: 'iconfont icon-yonghu',
        103: 'iconfont icon-quanxian',
        101: 'iconfont icon-yunliankeji-',
        102: 'iconfont icon-dingdan',
        145: 'iconfont icon-baobiao'
      },
      activePath: ''
    }
  },
  props: {
    menus: {
      type: Array,
      default () {
        return []
      }
    },
    iscollapse: {
      type: Boolean,
      default () {
        return false
      }
    }
  },
  created () {
    // console.log(this.menus)
    this.activePath = window.sessionStorage.getItem('activePath')
    // console.log(this.activePath)
  },
  methods: {
    activePathclick (activePath) {
      window.sessionStorage.setItem('activePath', activePath)
      this.activePath = activePath
    }
  }
}
</script>

<style>
  .iconfont {
    margin-right: 10px;
    font-weight: 700px;
    color: black !important;;
  }
  .el-menu {
    /*  去除一下我有个多了的边框的问题 */
    border-right: 0px!important;
  }
</style>
